Øyvind Kolås [Mon, 25 Sep 2017 19:41:36 +0000 (21:41 +0200)]
tests/grayscale_to_rgb: increase printed debug precision
Øyvind Kolås [Mon, 25 Sep 2017 19:06:46 +0000 (21:06 +0200)]
tests: move non-test binaries from here to ../tools
Øyvind Kolås [Mon, 25 Sep 2017 19:00:08 +0000 (21:00 +0200)]
babl: check both source/dest bits/component in bad_idea()
Øyvind Kolås [Mon, 25 Sep 2017 18:56:55 +0000 (20:56 +0200)]
babl: add decrease of bits per components to bad_idea()
related to bug #787441
Øyvind Kolås [Mon, 25 Sep 2017 18:33:17 +0000 (20:33 +0200)]
tests: use a epsilon instead of == for float compare
Øyvind Kolås [Mon, 25 Sep 2017 18:04:54 +0000 (20:04 +0200)]
build: link extensions against internal .la again
Øyvind Kolås [Mon, 25 Sep 2017 17:53:52 +0000 (19:53 +0200)]
babl: limit exported symbols
For now, also including symbols needed for internal tools and tests, that are
not part of the public API; the API promised by babl remains the public
headers, but this reduces the public dynamic loaders namespace a little.
Øyvind Kolås [Mon, 25 Sep 2017 10:56:17 +0000 (12:56 +0200)]
babl: tidying of public headers
Ell [Sun, 24 Sep 2017 21:46:50 +0000 (17:46 -0400)]
babl: in babl_polynomial_approximate_gamma(), verify that x0 >= 0
Now that the previous commit (hopefully) makes us iPhone-proof, we
can add an assertion for this condition. If we want to replace the
assertions with some sort of bailing, we'll need to replace the rest
of them too anyway.
Ell [Sun, 24 Sep 2017 21:34:00 +0000 (17:34 -0400)]
Bug 788093 - Crash loading (jpg with) ICC v4 profile with parametric TRCs
Fix parameter offset calculation of parametric TRCs, so that we
parse them correctry.
Ell [Sun, 24 Sep 2017 17:43:02 +0000 (13:43 -0400)]
babl: avoid negative degree when shrinking a zero polynomial
When shrinking a zero polynomial, avoid trying to set its degree
to a negative value, and just keep it at 0, which is the minimal
degree we support.
Note that this also happens for polynomials whose coefficients are
all NaN, as is the case in bug 788093, so they also become zero
polynomials after shrinking, incidentally.
Øyvind Kolås [Fri, 22 Sep 2017 12:50:48 +0000 (14:50 +0200)]
babl: make babl_space_to_icc internal, for now
Also adds an optimized 26 entry LUT, as used in the creation of
http://pippin.gimp.org/sRGBz/
Please enter the commit message for your changes. Lines starting
Øyvind Kolås [Tue, 19 Sep 2017 14:02:22 +0000 (16:02 +0200)]
babl: remove commented out debug printfs
Øyvind Kolås [Mon, 18 Sep 2017 17:24:35 +0000 (19:24 +0200)]
babl: improve icc number serialization
Øyvind Kolås [Mon, 18 Sep 2017 17:17:56 +0000 (19:17 +0200)]
babl: add matrix re-equalization
This optimizes the coefficients of the matrix ensuring that a RGB 1.0 1.0 1.0
results in exactly CIE Lab 100.0 0.0 0.0 and that equal R,G,B triples yield 0.0
for CIE a, b. This is achieved by rounding to 16.16 fixed point precision,
which can be exactly represented by IEEE double, and then brute-force jittering
the coefficients +/- 1 for the best solution. This is also the rounding needed
for making the matrix well behaved when used in an ICC profile.
Øyvind Kolås [Mon, 18 Sep 2017 00:47:52 +0000 (02:47 +0200)]
babl: tidy up icc writing
Øyvind Kolås [Sun, 17 Sep 2017 18:24:16 +0000 (20:24 +0200)]
babl: make powf approximation yield 0 for negatives
Jehan [Wed, 5 Jul 2017 00:15:27 +0000 (02:15 +0200)]
babl: improve log output on Android.
No need to log end of lines. This is not like a printf where we are
trying to pretty-print.
Jehan [Tue, 4 Jul 2017 14:47:52 +0000 (16:47 +0200)]
babl: replace a fprintf (stderr, ...) with babl_log().
It will make it visible in the logcat, for instance in Android Studio.
As a general rule, we should use babl_log() for anything which we
consider as "logs", unless we want to direct them to a given output for
sure (for instance in the case of CLI tools where we want the output to
be on standard I/O in terminal, fprintf() still is the best choice).
Øyvind Kolås [Thu, 14 Sep 2017 19:24:22 +0000 (21:24 +0200)]
tests: make babl build on haiku
Using -lphtread instead of -pthread in Makefile.am fixes the build when using
gcc-x86 under haiku, figured out by schumaml.
Øyvind Kolås [Thu, 14 Sep 2017 16:32:09 +0000 (18:32 +0200)]
babl/base: model-gray, avoid potential NaN
Øyvind Kolås [Fri, 8 Sep 2017 19:26:04 +0000 (21:26 +0200)]
babl: add rendering intent argument to icc loading API
Øyvind Kolås [Wed, 13 Sep 2017 20:08:27 +0000 (22:08 +0200)]
babl: abstract out TRC gamma detectors
Jehan [Tue, 4 Jul 2017 14:35:46 +0000 (16:35 +0200)]
babl: babl_log() implementation for Android.
Øyvind Kolås [Wed, 13 Sep 2017 16:04:49 +0000 (18:04 +0200)]
babl: skip unknown formats when loading cache
Fixes bug #787467.
Formats based on custom primaries provided by applications are unknown to babl
at launch, we still want to keep the data though, since this list of most used
fishes first is useful resource in combination with the warnings about missing
fast paths.
Øyvind Kolås [Wed, 13 Sep 2017 13:10:07 +0000 (15:10 +0200)]
babl: make utility file reading function non-static
Øyvind Kolås [Tue, 12 Sep 2017 21:49:58 +0000 (23:49 +0200)]
babl: remove inlined implementation of powf
Øyvind Kolås [Tue, 12 Sep 2017 20:33:15 +0000 (22:33 +0200)]
babl: replace trc lut inverter with binary search
Much faster and much more accurate.
Øyvind Kolås [Fri, 8 Sep 2017 19:26:04 +0000 (21:26 +0200)]
babl: add icc meta-data extraction functions
Instead of extracting all meta-data of ICC profiles and attaching them to
BablSpaces, we provide an string key/value API to query meta data of in-memory
ICC profiles.
Ell [Sun, 10 Sep 2017 17:33:41 +0000 (13:33 -0400)]
tools: add BablPolynomial test to trc-validator.c
Ell [Sun, 10 Sep 2017 15:38:01 +0000 (11:38 -0400)]
babl: in BablTRC, use BablPolynomial to approximate gamma func.
Use BablPolynomial to approximate gamma functions of TRCs over the
(0, 1) range, for FORMULA_GAMMA and FORMULA_SRGB TRCs.
Use generic FORMULA_GAMMA TRCs for 1.8 and 2.2 gammas, instead of
specialized versions.
Ell [Sun, 10 Sep 2017 15:30:56 +0000 (11:30 -0400)]
babl: add babl-polynomial.[hc]
Implements BablPolynomial, an opaque type representing a real valued
polynomial of a real variable. Currently, exposes the following
functions:
* babl_polynomial_eval(): Evaluates a polynomial.
* babl_polynomial_approximate_gamma(): Calculates a polynomial
approximation of a gamma function.
Øyvind Kolås [Sun, 10 Sep 2017 22:41:47 +0000 (00:41 +0200)]
babl: further nan prevention in babl-trc
Ell [Sun, 10 Sep 2017 15:27:43 +0000 (11:27 -0400)]
babl: in babl-trc.c, fix babl_powf()
Øyvind Kolås [Fri, 8 Sep 2017 18:26:47 +0000 (20:26 +0200)]
babl: avoid accidental matrix overwrite by long names
.. by increasing the static per space allocation to 512 bytes, these names need
to become shorter - or the name be allocated dynamically. This fixes problems
with parameterized lab / sRGB like TRCs - which yielded really long names.
Øyvind Kolås [Fri, 8 Sep 2017 16:35:59 +0000 (18:35 +0200)]
babl: protect some functions used by TRC code from NaNs
Øyvind Kolås [Fri, 8 Sep 2017 16:35:16 +0000 (18:35 +0200)]
babl: actually reverse preceding change
Øyvind Kolås [Fri, 8 Sep 2017 16:21:46 +0000 (18:21 +0200)]
restore segfault for massimo
Øyvind Kolås [Fri, 8 Sep 2017 15:21:37 +0000 (17:21 +0200)]
@massimo: pretty please use git :)
It would be really nice if others, and prolifix people like
you, prepared git formatted patches, so that it is much saner
and easier to push and work with contributions as a maintainer
with a dirty tree, and in even more valuable bugs than this
one.. without needing to re-read and re-understand the entire
context of the fix, before fully reimplementing it.
This commit fixes bug #787441, where NaN is polluting the
computer error/tolerance.
Øyvind Kolås [Thu, 7 Sep 2017 17:14:55 +0000 (19:14 +0200)]
extensions: finish API update
Øyvind Kolås [Thu, 7 Sep 2017 15:46:29 +0000 (17:46 +0200)]
NEWS: aggregate news
Øyvind Kolås [Thu, 7 Sep 2017 15:29:49 +0000 (17:29 +0200)]
update docs
Øyvind Kolås [Thu, 7 Sep 2017 14:36:14 +0000 (16:36 +0200)]
extensions: follow change dropping long return
Øyvind Kolås [Thu, 7 Sep 2017 13:48:13 +0000 (15:48 +0200)]
babl: drop long return from conversion funcs
They are propagated and instructions are spent on that, but their value are
never used. Some conversion functions in base even used the argument passed for
counting down to 0 and return 0 instead, to no ill effect.
Since we do not currently see external babl extensions, we can break extensions
API without bumping the library version, this is even a change where due to
varargs, old extensions will continue working until migrated.
Øyvind Kolås [Wed, 6 Sep 2017 23:25:33 +0000 (01:25 +0200)]
babl: remove unused static linear luts for u8 rgb space converters
Øyvind Kolås [Wed, 6 Sep 2017 23:07:28 +0000 (01:07 +0200)]
extensions: keep old algoritmic float in parallel with table
The newly introduced table isn't bit accurate with our reference,
the ~3x faster float 2 half conversion is available with a higher
tolerance.
Øyvind Kolås [Wed, 6 Sep 2017 23:01:19 +0000 (01:01 +0200)]
extensions: fix type error in float 2 half
Øyvind Kolås [Wed, 6 Sep 2017 22:29:59 +0000 (00:29 +0200)]
extensions: make float-half extension use exact LUTs
Both for conversion from half to float with a on load initialized table, and
with new tables an faster approach from qcms / mozilla / webkit.
Øyvind Kolås [Wed, 6 Sep 2017 21:22:18 +0000 (23:22 +0200)]
babl: make more use of float matrices where appropriate
Øyvind Kolås [Tue, 5 Sep 2017 11:57:50 +0000 (13:57 +0200)]
babl: trade gained fishing performance for better fish
Øyvind Kolås [Tue, 5 Sep 2017 01:36:22 +0000 (03:36 +0200)]
babl: bail early on paths that are bad ideas
Not going through/bench-marking chains that will make the number of components
drop below the input/output counts, and not permitting a temporary lack of
alpha both fixes bugs at higher tolerances and speeds up path selection.
Øyvind Kolås [Sun, 3 Sep 2017 20:53:27 +0000 (22:53 +0200)]
babl: add babl_fast_fish api
Øyvind Kolås [Sun, 3 Sep 2017 16:36:41 +0000 (18:36 +0200)]
babl: add R'G'B' u8 color space convertors
Øyvind Kolås [Sun, 3 Sep 2017 16:27:49 +0000 (18:27 +0200)]
babl: make TRCs internal API
Øyvind Kolås [Sun, 3 Sep 2017 16:19:35 +0000 (18:19 +0200)]
babl: add Rec2020 space
Øyvind Kolås [Sun, 3 Sep 2017 14:25:03 +0000 (16:25 +0200)]
babl: make matrix+trc space detector generic
Øyvind Kolås [Sun, 3 Sep 2017 14:03:13 +0000 (16:03 +0200)]
babl: abstract space duplicate detection
Øyvind Kolås [Sun, 3 Sep 2017 13:09:57 +0000 (15:09 +0200)]
tools: follow constness change in icc parsing error handling
Øyvind Kolås [Sun, 3 Sep 2017 13:06:37 +0000 (15:06 +0200)]
babl: make error argument of babl_space_from_icc optional
Øyvind Kolås [Sat, 2 Sep 2017 23:00:49 +0000 (01:00 +0200)]
babl: detect sRGB profiles from matrix
When TRCs also are matching, return internal sRGB instead of creating a
duplicate.
Øyvind Kolås [Sat, 2 Sep 2017 23:00:21 +0000 (01:00 +0200)]
babl: indentation in trc
Øyvind Kolås [Sat, 2 Sep 2017 22:50:12 +0000 (00:50 +0200)]
babl: move srgb detection to srgb_formula constructor
Øyvind Kolås [Sat, 2 Sep 2017 20:42:05 +0000 (22:42 +0200)]
babl: fix overflow detection at end of luts
Øyvind Kolås [Sat, 2 Sep 2017 20:30:12 +0000 (22:30 +0200)]
babl: implement interpolation for lut trcs
Øyvind Kolås [Sat, 2 Sep 2017 16:18:49 +0000 (18:18 +0200)]
babl: icc implement ascii decoding of mluc
Øyvind Kolås [Sat, 2 Sep 2017 15:09:20 +0000 (17:09 +0200)]
babl: add parametric handling for sRGB style TRCs (icc V4)
Øyvind Kolås [Sat, 2 Sep 2017 13:33:19 +0000 (15:33 +0200)]
babl: use trcs own fun directly in early stages
Øyvind Kolås [Sat, 2 Sep 2017 13:32:23 +0000 (15:32 +0200)]
tools: babl-icc-rewrite; abort with error message instead of segfault
Øyvind Kolås [Sat, 2 Sep 2017 13:31:52 +0000 (15:31 +0200)]
babl: use babl_malloc instead of misgided use of aligned_alloc thinking it was like alloca
Jehan [Sat, 2 Sep 2017 12:18:07 +0000 (14:18 +0200)]
babl: use _aligned_malloc() instead of aligned_alloc() on Win32.
Thanks to Lionel N. for raising the issue. It was failing to build for
Windows with:
> babl/babl-space.c:503: undefined reference to `aligned_alloc'
Windows has apparently a similar API, except that the size and alignment
parameters are inverted.
See https://msdn.microsoft.com/library/8z34s9c6.aspx
Øyvind Kolås [Fri, 1 Sep 2017 20:52:27 +0000 (22:52 +0200)]
babl-icc: add support for some ICCv4 profiles
RGB Matrix profiles with not too complex (or sRGB) parametric TRCs is what
should work fine.
Øyvind Kolås [Fri, 1 Sep 2017 19:31:24 +0000 (21:31 +0200)]
babl: move RGB space conversion code to babl-space.c
Øyvind Kolås [Fri, 1 Sep 2017 18:03:13 +0000 (20:03 +0200)]
babl: make trcs capable of iterating buffers
Øyvind Kolås [Fri, 1 Sep 2017 17:19:39 +0000 (19:19 +0200)]
babl: do one SSE2 memory load per pixel for color matrix transform
Øyvind Kolås [Fri, 1 Sep 2017 16:34:13 +0000 (18:34 +0200)]
babl: add sse2 acceleration for color transform
Many of the code paths are now duplicated, the duplication should decrease as
the SSE2/SIMD versions evolve further and stop resembling the code they were
cloned from.
Øyvind Kolås [Thu, 31 Aug 2017 22:02:32 +0000 (00:02 +0200)]
babl: change MAX_BUFFER_SIZE to 512
This is the value that determins the smaller size big buffers are broken up in
and processed chunk-by chunk for multi-path conversions.
With tools/babl-benchmark for a particular workload and machine the following
results were attained, all values are in mb/s. There seem to be two sweet-spots
one around 128 and one around 512. Now using 512 which probably has better
cache behavior on most cpus than the old value 2048.
MAX_BUFFER_SIZE benchmarks,
8: 437.1
16: 458.8
32: 495.0
64: 482.6
96: 496.4
127: 508.8
128: 514.2 506.7 495.1
130: 494.6
150: 479.5
255: 492.2
256: 491.0 486.8
384: 500.8
450: 503.7
500: 499.6 496.5
511: 477.8
512: 511.0 508.7 500.6
514: 499.3
515: 504.7 502
520: 512.9 491
530: 501.8
550: 483.3
768: 493.0
1024: 491.6
2048: 489.5
4096: 501.2
8192: 499.0
Øyvind Kolås [Thu, 31 Aug 2017 21:07:34 +0000 (23:07 +0200)]
babl: refactor matrix_mul_vector further towards SIMD
Øyvind Kolås [Thu, 31 Aug 2017 20:11:14 +0000 (22:11 +0200)]
babl: register more RGB auto-converters for non-sRGB spaces
Øyvind Kolås [Thu, 31 Aug 2017 15:27:20 +0000 (17:27 +0200)]
babl: use floating point version of srgb trc func
Øyvind Kolås [Thu, 31 Aug 2017 14:37:32 +0000 (16:37 +0200)]
tools: add c program for validating TRC approximations
Øyvind Kolås [Thu, 31 Aug 2017 11:16:28 +0000 (13:16 +0200)]
replace gamma approximations
Øyvind Kolås [Thu, 31 Aug 2017 04:19:09 +0000 (06:19 +0200)]
babl: move trc functions inside babl-trc.c
Use lolremez 9 degree polynominal approximations for 1.8 and 2.2 gamma.
Øyvind Kolås [Thu, 31 Aug 2017 03:32:42 +0000 (05:32 +0200)]
babl: add separate functions for 1.8 and 2.2 gamma
Øyvind Kolås [Thu, 31 Aug 2017 03:10:24 +0000 (05:10 +0200)]
babl: optimize powf and its use in u8tou8 internal converter
Øyvind Kolås [Thu, 31 Aug 2017 03:09:09 +0000 (05:09 +0200)]
babl: change how conversion computers (own) error
Øyvind Kolås [Thu, 31 Aug 2017 02:49:06 +0000 (04:49 +0200)]
tools: babl-benchmark, print chosen paths
Øyvind Kolås [Thu, 31 Aug 2017 02:46:29 +0000 (04:46 +0200)]
babl: include out own powf implementation
Øyvind Kolås [Wed, 30 Aug 2017 16:03:18 +0000 (18:03 +0200)]
reduce set of default RGB spaces
Øyvind Kolås [Wed, 30 Aug 2017 15:57:12 +0000 (17:57 +0200)]
extensions/gray: add const for rgbtoxyz matrix return
Øyvind Kolås [Wed, 30 Aug 2017 15:54:44 +0000 (17:54 +0200)]
babl: only care about single precision for TRC
Øyvind Kolås [Wed, 30 Aug 2017 15:43:10 +0000 (17:43 +0200)]
babl: make use of more direct trc dispatch in base
Øyvind Kolås [Wed, 30 Aug 2017 15:29:01 +0000 (17:29 +0200)]
extensions: more direct trc dispatch
Øyvind Kolås [Wed, 30 Aug 2017 15:09:28 +0000 (17:09 +0200)]
babl: speed up trc dispatch
By splitting the core computation done by the TRC down to callbacks of
different types, that all optionally can use the provided trc object. This way
we can move the conditional for the polymorphism out of loops. The higher level
API of using the TRC still works - and is also accelerated by this change.
Øyvind Kolås [Wed, 30 Aug 2017 14:38:05 +0000 (16:38 +0200)]
babl: silence cast warning
Øyvind Kolås [Wed, 30 Aug 2017 02:32:22 +0000 (04:32 +0200)]
babl: add commented out u8 rgb to rgb converter
Øyvind Kolås [Wed, 30 Aug 2017 00:20:47 +0000 (02:20 +0200)]
babl: register conversions between all RGB spaces
we register RGBA float and R'G'B'A float converters
between all spaces. This permits the converters between
precisions for each space to take effect.
Øyvind Kolås [Sat, 26 Aug 2017 20:55:28 +0000 (22:55 +0200)]
babl: add single precision cmm matrices
Øyvind Kolås [Tue, 29 Aug 2017 09:51:17 +0000 (11:51 +0200)]
babl: on demand clone sRGB conversions
When a new RGB space is encountered clone all sRGB space to sRGB space
conversions, under the assumption that they are implemented respecting/using
the customizable TRCs of babl.
Øyvind Kolås [Wed, 30 Aug 2017 01:49:32 +0000 (03:49 +0200)]
extensions/CIE: use RGB space functions for xyz
Øyvind Kolås [Tue, 29 Aug 2017 23:35:20 +0000 (01:35 +0200)]
extensions/gimp-8bit: use RGB space TRCs